<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>实名认证解限详情</title>
    <link rel="icon" href="favicon.ico" type="image/x-icon"/>
    <!-- 当前页面样式 -->
    <link rel="stylesheet" href=<s:url value="/css/common.css"/>>
	<script type="text/javascript" src="<s:url value="/js/jquery-1.9.1.js" />"></script>
	<script type="text/javascript" src="<s:url value="/js/jquery.validate.min.js" />"></script>
	<script type="text/javascript" src="<s:url value="/js/pwms.validate.js" />"></script>
	<script type="text/javascript" src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
	<script type='text/javascript' src='<s:url value="/js/YLlightbox.js"/>'></script>
	<script type='text/javascript' src='<s:url value="/js/pageAjax.js"/>'></script>
	<script type='text/javascript' src='<s:url value="/js/checkMerinfoinfoCount.js"/>'></script>
	<script type='text/javascript' src='<s:url value="/js/ajaxfileupload.js"/>'></script>
	<style>
		 .fieldError { color: red; text-align: left; }
		.error { float: none; color: red;  vertical-align: top;font-size: 11px;}
		#YLimgwrap {
		  position: fixed;
		  left: 0;
		  top: 0;
		  right: 0;
		  bottom: 0;
		  background: rgba(0, 0, 0, 0);
		  z-index: 10;
		  display: none;
		}
	</style>
</head>
<body>

<s:form id="oprAuthReleLimitForm" method="POST" onsubmit="return checkForm();" action="/ysbMerDetailInfo/oprAuthReleaseLimit.ct" theme="simple">
<s:hidden id="receiveId" name="receiveId" value="%{#request.operatorAuth.receiveId}"/>
<s:hidden id="accountNo" name="accountNo" value="%{#request.operatorAuth.accountNo}"/>
<s:hidden id="detailId" name="detailId" value="%{#request.operatorAuth.id}"/>
<table class="tb" style="width:100%">
    <tbody>
        <tr class="tb-line">
            <td class="tb-td" colspan="4" ><div class="tb-h3">付临门云商宝会员实名解限</div></td>
        </tr>
        <tr class="tb-line">
            <td align="right" class="tb-td" style="width:130px;">
                <div class="tb-h4">账户：</div>
            </td>
            <td class="tb-td" >
             	<label class="tb-input-lengthen">
             	<s:property value="#request.operatorAuth.accountNo"/>
             	<s:if test="#request.operatorAuth.phoneReason != null">
             		<font color="red">
             			（该手机号为黑名单）
             		</font>
             	</s:if>
             	<s:else>
             		<font color="red">
             			（正常）
             		</font>
             	</s:else>
                </label>
            </td>
            <td align="right" class="tb-td" style="width:130px;">
                <div class="tb-h4">真实姓名：</div>
            </td>
            <td class="tb-td" >
             	<label class="tb-input-lengthen">
             	<s:property value="#request.operatorAuth.userName"/>
             	<s:hidden id="realName" name="realName" value="%{#request.operatorAuth.userName}"/>
				</label>
            </td>
        </tr>

        <tr class="tb-line">
            <td align="right" class="tb-td" style="width:130px;">
                <div class="tb-h4">证件类型：</div>
            </td>
            <td class="tb-td" >
                <label class="tb-input-lengthen">
                <s:property value="%{#request.operatorAuth.cardType =='01'?'身份证':'其他'}"/> 
				</label>
            </td>
            <td align="right" class="tb-td" style="width:130px;">
                <div class="tb-h4">证件号码：</div>
            </td>
            <td class="tb-td" colspan="3" >
                <label class="tb-input-lengthen">
                <s:property value="#request.operatorAuth.cardNo"/>
                <s:hidden id="idCard" name="idCard" value="%{#request.operatorAuth.cardNo}"/>
                <s:if test="#request.operatorAuth.idCardReason != null">
             		<font color="red">
             			（该身份证号为黑名单）
             		</font>
             	</s:if>
             	<s:else>
             		<font color="red">
             			（正常）
             		</font>
             	</s:else>
				</label>
            </td>
        </tr>
        <tr class="tb-line">
            <td align="right" class="tb-td" style="width:130px;">
                <div class="tb-h4">身份证有效日期：</div>
            </td>
            <td class="tb-td">
                 <label class="tb-input-lengthen">
                	<s:property value="#request.operatorAuth.ext1"/>--<s:property value="#request.operatorAuth.ext2"/>
				</label> 
            </td>
            <td align="right" class="tb-td" style="width:130px;">
				<div class="tb-h4">身份证验证：</div>
			</td>
			<td class="tb-td" style="text-align: center;">
				<input style="width: 40px;height: 30px" id="yzBtn" type="button" value="验证" onclick="yzIdCard()"/> 
			</td>
        </tr>
        <tr class="tb-line">
            <td align="right" class="tb-td" style="width:130px;">
                <div class="tb-h4">驳回次数：</div>
            </td>
            <td class="tb-td" >
                <label class="tb-input-lengthen">
                <s:if test="#request.operatorAuth.authReasonList != null">
                	<s:property value="#request.operatorAuth.authReasonList.size()"/>
                </s:if>
                <s:else>
                	0
                </s:else>
				</label>
            </td>
            <td align="right" class="tb-td">
                <div class="tb-h4">驳回原因：</div>
            </td>
            <td class="tb-td" colspan="3" >
               <s:if test="#request.operatorAuth.authReasonList != null">
                <s:iterator value="#request.operatorAuth.authReasonList" var="authReasonList">
                	<s:iterator value="authReasonList" var="authReason">
                		<s:property value="authReason"/>
                	</s:iterator>
                	<br>
                </s:iterator>
                </s:if>
            </td>
        </tr>
		<tr class="tb-line">
			<td align="right" class="tb-td" style="width:130px;">
				<div class="tb-h4">限制理由：</div>
			</td>
			<td class="tb-td" colspan="3">
				<s:if test="#request.operatorAuth.limitReasonList != null">
					<s:iterator value="#request.operatorAuth.limitReasonList" var="limitReasonList">
						<s:iterator value="limitReasonList" var="limitReason">
							<s:property value="limitReason"/>
						</s:iterator>
						<br>
					</s:iterator>
				</s:if>
			</td>
		</tr>	
		<tr class="tb-line">
			<td align="right" class="tb-td">
				<div class="tb-h4"><code class="asterisk">*</code>解限备注：</div>
			</td>
			<td class="tb-td" colspan="3">
				<label class="tb-input-lengthen">
					<s:textarea rows="3" cols="180" id="releaseLimitDetail" name="operatorAuth.ext3" maxlength="80" cssStyle="width:80%;"  onpropertychange="textCounter(this,100);" oninput="textCounter(this,100);"/>
				</label>
			</td>
		</tr>
        <tr class="tb-line">
        	<td  class="tb-td" colspan="4" style="padding:0;">
        		<table style="width: 100%" class="tb-pic YLlightbox" >
        			<tr class="tb-line">
        				<td class="tb-td" style="padding:5px 0;border:1px solid #e2dfdf;">
        					<label class="pic-uploading">
	        					<a rel="YLlightbox" href="showPhone.ct?accountNo=<s:property value="#request.operatorAuth.accountNo"/>&fileName=<s:property value="#request.operatorAuth.frontImage"/>"  style="display: block;"  >
								         <img   src="showPhone.ct?accountNo=<s:property value="#request.operatorAuth.accountNo"/>&fileName=<s:property value="#request.operatorAuth.frontImage"/>">
								</a>
							</label>
							<div align="center">身份证正面照片</div>
        				</td>
        				<td class="tb-td" style="padding:5px 0;border:1px solid #e2dfdf;">
        					<label class="pic-uploading">
	        					<a rel="YLlightbox" href="showPhone.ct?accountNo=<s:property value="#request.operatorAuth.accountNo"/>&fileName=<s:property value="#request.operatorAuth.revereImage"/>"  style="display: block;" >
								      <img   src="showPhone.ct?accountNo=<s:property value="#request.operatorAuth.accountNo"/>&fileName=<s:property value="#request.operatorAuth.revereImage"/>">
								</a> 
							</label>
							<div align="center">身份证反面照片</div>
        				</td>
        				<td class="tb-td" style="padding:5px 0;border:1px solid #e2dfdf;">
        					<label class="pic-uploading">
	        					<a rel="YLlightbox" href="showPhone.ct?accountNo=<s:property value="#request.operatorAuth.accountNo"/>&fileName=<s:property value="#request.operatorAuth.handleImage"/>"  style="display: block;" >
								      <img   src="showPhone.ct?accountNo=<s:property value="#request.operatorAuth.accountNo"/>&fileName=<s:property value="#request.operatorAuth.handleImage"/>">
								</a> 
							</label>
							<div align="center">手持身份证正面照片</div>
        				</td>
        				<td class="tb-td" style="padding:5px 0;border:1px solid #e2dfdf;">
        					<label class="pic-uploading">
	        					<a rel="YLlightbox" href="showPhone.ct?accountNo=<s:property value="#request.operatorAuth.accountNo"/>&fileName=<s:property value="#request.operatorAuth.handleReverseImage"/>"  style="display: block;" >
								      <img   src="showPhone.ct?accountNo=<s:property value="#request.operatorAuth.accountNo"/>&fileName=<s:property value="#request.operatorAuth.handleReverseImage"/>">
								</a> 
							</label>
							<div align="center">手持身份证反面照片</div>
        				</td>
        			</tr>
        			<tr class="tb-line">
						<td class="tb-td" style="padding:5px 0;border:1px solid #e2dfdf;">
						<div class="pic-uploading">
							<p>担保函照片</p>
							<input type="file" name="file" id="imgOne" onchange="uploadYsbImgNew('imgOne');"  accept="image/*" capture="camera" />
								<s:hidden id="imgOneId" name="operatorAuth.ext4" />
								<a rel="YLlightbox">
									<img style="height:100%;" />
								</a>
							<i class="delete-pic"></i>
						</div>
						<div class="tb-normal" id="divOne"><code class="asterisk">*</code>请上传担保函照片</div>
						</td>
					</tr>
        		</table>
        	</td>
        </tr>
		
	</tbody>
</table>
	<div align="center" class="line-submit bg-gray">
		<label class="tb-input-submit">
			<input id="submitBtn" type="submit" value="提交"/>
		</label>
		<label class="tb-input-submit">
			<input id="backBtn" type="button" value="返回" onclick="history.back()"/>
		</label>
	</div>
</s:form> 
</body>

<script>
	var currentTerNum=1;
	$(function () {
		$('.delete-pic').on('click',deleteImage);
		$("#YLimgwrap").bind("click",function(e){ 
			var target = $(e.target); 
			if(target.closest("#YLimgcon").length == 0){ 
				$(".YLt_close").trigger("click");
			} 
		}); 
	}); 

	
	function yzIdCard(){
		debugger;
		var idCard = $("#idCard").val();
		var realName = $("#realName").val();
		$("#yzBtn").attr('disabled',true);
		$.ajax({
			url:"<%=basePath%>operatorAuthCheck/yzIdCard.ct",
			type:"post",
			data:{"realName":realName,"idCard":idCard},
			dataType:"json",
			success:function(result){
				var msgCode = result.msgCode;
				var msgText = result.msgText;
				if(msgCode == "00"){
					alert("认证一致");
					var photos = result.photos;
					var strShow = "data:image/jpeg;base64,"+photos;
					var str = "<img  src='"+strShow+"' style='width: 200px; hight: 200px'>";
					$("#tdShow").html(str);
					$("#trShow").show();
				}else{
					alert(msgText);
				}
				
			},error:function(){
				alert("未知错误！");
			}
		});
	}
	
	function checkForm(){
		if($.trim($("#releaseLimitDetail").val()).length == 0){
			alert("解限备注必填！");
			return false;
		}
		if($.trim($("#imgOneId").val()).length == 0){
			alert("请上传担保函照片！");
			return false;
		}
		$("#submitBtn").attr("disabled",true);
		return true;
	}
	
	/**
	   * 云商宝解限上传担保函照片
	   * @param id
	   * @param type
	   */
		function uploadYsbImgNew(id){
			var $this = $("#"+id); /// 点击的对象 
			var imageFile =$this.attr("id");
			var imageUrl =$this.siblings("input:hidden");
			var a=$this.parent().find('a');
			var img=$this.parent().find('img');
			var i = $this.parent().find('i');
			var url=$("url").val();
			var accountNo = $("#accountNo").val();
			var flag=fileInfo(imageFile);
			if(flag){
				$.ajaxFileUpload({
					fileElementId: imageFile,
					url: '/fmposm/upload/uploadYsbImg.ct',
					dataType: 'json',
					data: {"accountNo":accountNo,"timestamp":timestamp},
					beforeSend: function (XMLHttpRequest) {
				},
					success: function (data, textStatus) {
					var statusCode = data.statusCode;
					if(statusCode=="success"){
						var name=encodeURI(data.date);
						var url="http://"+window.location.host+"/fmposm/operatorAuthCheck/showPhone.ct?accountNo="+accountNo+"&fileName="+name;
						//var url="http://shoudan.freemypay.com:18090/fmposm/operatorAuthCheck/showPhone.ct?accountNo="+accountNo+"&fileName="+name;
						url=encodeURI(url);
						img.attr("src",url+"&time="+new Date().getTime());
						a.attr("href",url+"&time="+new Date().getTime());
						imageUrl.val(name);
						$("#div"+imageFile.split("img")[1]).find("label").html("");
						$("#div"+imageFile.split("img")[1]).find("code").html("");
						a.css("display","block");
						i.show();
					}else{
						alert("上传失败");
					}
				},
				error: function (XMLHttpRequest, textStatus, errorThrown) {  
					alert("上传失败");
				},
				complete: function (XMLHttpRequest, textStatus) {  
			}
			});  
			}
		}
</script>
</html>
